#ifndef __LIB_KERNEL_VMM_H
#define __LIB_KERNEL_VMM_H
#include "stdint.h"                 //我们的stdint.h中定义了数据类型，包含进来
#include "global.h"
#include "virtual_pit8253.h"
#include "virtual_pic8259a.h"
#include "shadow_page_table.h"




extern uint32_t guest_kernel_page_table_vaddr;
extern uint32_t guest_kernel_page_table_phyaddr;

struct task_struct* create_vm(char* name);

struct task_struct* create_vcpu(char* name);

void guest_kernel_init(void);


void guest_memory(void);


void vm_entry(void* arg);
void vm_exit(void);

uint32_t* create_guest_page_dir(void);

void page_dir_activate_test(struct task_struct* p_thread);

uint32_t addr_v2p(uint32_t vaddr);

uint32_t* create_guestkernel_pagetable(void);


#define VCPU_PTR ((void *)0xc0053000)

#define VIRTUAL_PIT ((void *)0xc0053100)
#define VIRTUAL_PIC_MASTER ((void *)0xc0053200)
#define VIRTUAL_PIC_SLAVE ((void *)0xc0053200)

#define vaddrrr ((void *)0xc0500000)
#define page_phyaddr ((void *)0x00500000)

#define	 PG_P_1	  1	// 页表项或页目录项存在属性位
#define	 PG_P_0	  0	// 页表项或页目录项存在属性位
#define	 PG_RW_R  0	// R/W 属性位值, 读/执行
#define	 PG_RW_W  2	// R/W 属性位值, 读/写/执行
#define	 PG_US_S  0	// U/S 属性位值, 系统级
#define	 PG_US_U  4	// U/S 属性位值, 用户级

#endif
